package gz.smx.service;

import gz.smx.mapper.UserMapper;
import gz.smx.pojo.User;

public class UserService {

    private UserMapper userMapper;
    public UserService(UserMapper userMapper){
        this.userMapper=userMapper;
    }

    public boolean insert(User user){
        return userMapper.insertUser(user) > 0 ? true: false;
    }

    public void selectById(Long id){
        User user =userMapper.selectByPrimaryKey(id);
        if (user != null){
            System.out.println("用户信息: " + user);
        }
        else {
            System.out.println("不存在id为： " + id+"用户");
        }
    }
}
